<?php
/**
 * True Gallery Category template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename category.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$inline		= JTuneConfig::getValue('ad_cp');
//$config =& JTuneConfig::getInstance();
//xdump( $config );

$line_index	= 0;

$icells = count($rows);
if( $tpl->item % $inline == 0 ) {
	$row1 = '<tr>';
	$row2 = '<tr>';
}
// image cell for first row
$row1 .= '
<td class="imagecell"><span class="publishdate">'.$tpl->publishupdate.'</span>
	<!--a href="'.$tpl->original.'" rel="lightbox-tour" title="'.$tpl->title.'"><img src="'.$tpl->imgsrc.'" alt="'.$tpl->title.'" /></a-->
	<a href="'.$tpl->catlink.'" rel="lightbox-tour" title="'.$tpl->title.'"><img src="'.$tpl->imgsrc.'" alt="'.$tpl->title.'" /></a>
</td>';

// description cell for second row
$row2 .= '
<td class="imagefooter">
	<span class="title">'.$tpl->title.'</span>
	<span class="description">'.$tpl->description.'</span>
</td>';

if( $tpl->item % $inline == $inline - 1 ) {
	$row1 .= '</tr>';
	$row2 .= '</tr>';
	echo $row1;
	echo $row2;
} else if( $icells - 1 == $tpl->item ) {
	// we are on last line
	$ostatok	= $inline - $icells % $inline; // full qty of cells
	$s			= str_repeat('<td></td>', $ostatok).'</tr>';
	$row1	   .= $s;
	$row2	   .= $s;
	echo $row1;
	echo $row2;
}
